package com.zjx.springcloud.controller;

import com.zjx.springcloud.entities.ResultVO;
import com.zjx.springcloud.entities.test.Test;
import com.zjx.springcloud.service.dept.DeptClientService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.cloud.client.discovery.DiscoveryClient;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RestController;

@SuppressWarnings("all")
@RestController
public class DeptController_Consumer {

  //  public static final String REST_URL_PREFIX="http://localhost:8001";
    public static final String REST_URL_PREFIX="http://CLOUD-DEPT";

    @Autowired
   private DeptClientService deptClientService;
//    @Autowired
//   private RestTemplate restTemplate;
    @Autowired
    private DiscoveryClient client;
//    /**
//     * @api {post,get} /consumer/dept/add   添加User的接口
//     * @apiName 添加用户
//     * @apiGroup user
//     * @apiDescription 添加用户的接口
//     * @apiParam (Integer) userId 用户id
//     * @apiParam (string) username 用户名
//     * @apiParam (string) password 用户名密码
//     *  @apiSuccessExample {json} 正确返回值:
//     *  *     {
//     *  *   "code": 0,
//     *  *   "msg": "OK ",
//     *  *   "data": [
//     *  *       {
//     *  *           "id": "622051004185471233",
//     *  *           "testCode": "000050",s
//     *  *       }
//     *  *   ],
//     *  *   "status": "ok",
//     *  *   "count": "14"
//     *  *   }
//     * @apiSuccess (200) status 成功
//     * @apiError (500) status 错误s
//     * @apiError (501) status 错误
//     */
//    @RequestMapping(value = "/consumer/dept/queryAll",method = {RequestMethod.GET,RequestMethod.POST})
//    public ResultVO queryAlls(Test dept) {
//
//            return  restTemplate.postForObject(REST_URL_PREFIX+"/dept/queryAll",dept,ResultVO.class);
//    }



    @RequestMapping(value = "/consumer/dept/queryAll")
    public ResultVO queryAlls(Test dept) {

            return  deptClientService.queryAll(dept);
    }
}
